package com.itheima.d1_exception;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 目标：掌握异常的甩锅处理方式throws
 */
public class ExceptionTest2 {
    public static void main(String[] args) {
        String str = "1999-12-12 12:12:12";
        parseTest2(str);

    }
    public static void parseTest2(String data){
        //日期格式化异常
        Date parse = null;
        try {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            parse = sdf.parse(data);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        System.out.println("parse = " + parse);
    }

}
